//
//  ViewController.m
//  没有尺寸的父控件
//
//  Created by J on 15/11/23.
//  Copyright © 2015年 J. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    UIButton * red =[UIButton new];
//    red.frame = CGRectMake(100, 100, 50, 50);//此时不在父控件的部分 不能接收事件响应
//    red.frame = CGRectMake(100, 0, 50, 50);//父控件不可见 但是子控件 依然课件 但是无法进行事件传递
    [red addTarget:self action:@selector(orangeClick) forControlEvents:UIControlEventTouchUpInside];
    red.backgroundColor =[UIColor orangeColor];
    [self.view addSubview:red];
    
    
    
    UIButton * blue=[UIButton new];
    blue.frame = CGRectMake(25, 25, 50, 50);
    [blue addTarget:self action:@selector(purpleClick) forControlEvents:UIControlEventTouchUpInside];

    blue.backgroundColor =[UIColor purpleColor];
    [red addSubview:blue];
    
    


}
- (void)orangeClick{
    
    NSLog(@"%s",__func__);
    
}
- (void)purpleClick{
    
    NSLog(@"%s",__func__);

    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
